/*================================================================
 *   Copyright (C) 2021 All rights reserved.
 *   
 *   文件名称：test_fiber.cc
 *   创 建 者：汉森伯逸
 *   创建日期：2021/4/29
 *   描    述：
 *
 *================================================================*/

#include "hsby.h"


void cb_fiber1() {
    //HSBY_LOG_SYSTEM_DEBUG << "begin cb_fiber1";
    //HSBY_LOG_SYSTEM_DEBUG << "end cb_fiber1";
}

void test_fiber() {
    //HSBY_LOG_SYSTEM_DEBUG << "begin test_fiber";
    hsby::Fiber::GetCurrentFiber();
    hsby::Fiber::Ptr fiber(new hsby::Fiber(cb_fiber1));
    //HSBY_LOG_SYSTEM_DEBUG << "1 fiber->call()";
//    fiber->call();
    //HSBY_LOG_SYSTEM_DEBUG << "end test_fiber";
}

void test_thread_fiber() {
    std::vector<hsby::Thread::Ptr> ths;
    for (int i = 0; i < 1; ++i) {
        ths.push_back(std::make_shared<hsby::Thread>(test_fiber, "thread_" + std::to_string(i)));
    }
    for(auto& it : ths) {
        it->join();
    }
}

int main() {
    test_thread_fiber();
}